Softbank Robotics Corp. 2017 All rights reserved.
ワー ショップ 番外編
Pytれんを入門∼Paィtし∼
1
2017/7/11
Softbank Robotics
Softbank Robotics Corp. 2017 All rights reserved.
ワー ショップ
い
免責事項
2
ワー ショップ
エ ス ッフ 作成
あ
ソフ
ン 公式
い
Softbank Robotics Corp. 2017 All rights reserved.
エ
い
✓
Pepper
プ 開発 実体験
実体験 コミュ ティー 開発 促進する
エ
コ ュ
ー
✓
経験や知見 共有
相互
促進
Softbank Robotics Corp. 2017 All rights reserved.
エ
い
実体験 コミュ ティー 開発 促進する
4
#1
#2
#3
#4
#5
#6
ワークショップ
ッ
ン
自由 開発
質問 ス ッフ
客様同士 交流
初級
Softbank Robotics Corp. 2017 All rights reserved.
エ
い
実体験 コミュ ティー 開発 促進する
5
#6
エサ
有志で
Pepper
と開発スペースを
提供している
企業、大学、コミュニティスペース
Softbank Robotics Corp. 2017 All rights reserved.
ワー ショップ番外編
い
タッフが製作したオ
ワー
ョップ
6
python
ワークショップ
てOぼ 編集
初級
中級
上級
変数 扱い方
関数 作
#1
#3
Softbank Robotics Corp. 2017 All rights reserved.
・お名前
・所属
・本日の意気込
・プロ
ミン 経験
例:
本日 案内 勤
せ い
大山
がMaィろれん Oyamaき 申
Softbank Robotics Corp. 2017 All rights reserved.
本日 内容
1.
BOX 読
基礎 学ぼう
ALPrんxy・入力・変数・出力
1.
BOX 編集しよう
Softbank Robotics Corp. 2017 All rights reserved.
てOぼ 読
Softbank Robotics Corp. 2017 All rights reserved.
Softbank Robotics Corp. 2017 All rights reserved.
Say Tらxt bんx
●
入力された言葉を話す
Softbank Robotics Corp. 2017 All rights reserved.
AばPィんxy
●
Python
で
Pepper
の機能にアクセスするための
naoqi
のモジュール
●
使う
API
によって色々な関数がある
12
使うAPね
Softbank Robotics Corp. 2017 All rights reserved.
Softbank Robotics Corp. 2017 All rights reserved.
入力
ッ が灰き
数や文字列
ス
“ ンナが黒き
信号
送
数が黄き
数字 持
状態 送
文字列が青き
文字列 持
状態 送
入力=引数
文字 置 換え 関数 作
Softbank Robotics Corp. 2017 All rights reserved.
ー ー
Softbank Robotics Corp. 2017 All rights reserved.
出力
んをStんppらよ
信号 出力
い
→イらlり.んをStんppらよがき 出力
Softbank Robotics Corp. 2017 All rights reserved.
Softbank Robotics Corp. 2017 All rights reserved.
例外処理
●
例外が実行中 検出
エ ーき処理コー
書
予期せ 事故
未然 防
●
tィy句:例外 起
そう 処理
●
らxょらpt句:例外 起
場合 処理
●
らlイら句:例外 検出
場合 処理がらxょらpt句 後
き
Softbank Robotics Corp. 2017 All rights reserved.
例外処理
tィy:
イらlり.lんるるらィ.ろをりんがxこyき
らxょらpt:
イらlり.lんるるらィ.ろをりんが"どィィんィ!"き
らlイら:
イらlり.lんるるらィ.ろをりんが"Suょょらイイ!"き
ダをally:
イらlり.lんるるらィ.ろをりんが"でんmplらtらよ!"き
~例~
~実行結果~
x = さごぐy = ご 時
どィィんィ!
でんmplらtらよ!
x = さごぐy = 2 時
す
Softbank Robotics Corp. 2017 All rights reserved.
Softbank Robotics Corp. 2017 All rights reserved.
ーSay Text bんx 読 ー
AばTらxtTんSpららょれ
いう機能 使用
文字列
変換
関数
sentence = “\RSPD=100\ \VCT=100 \\
こんにちは
\RST\”
AばTらxtTんSpららょれ
イay いう関数 使用
Softbank Robotics Corp. 2017 All rights reserved.
演習!
Softbank Robotics Corp. 2017 All rights reserved.
ボタンでアプリを再生
のアイコン を
ダブルクリックしてしゃべる内容を変える
のパラメーターボタンは
声質を変えられる。
会話
てOぼ bらりんィら
23
Softbank Robotics Corp. 2017 All rights reserved.
ボタンでアプリを再生
のアイコン を
ダブルクリックしてしゃべる内容を変える
のパラメーターボタンは
声質を変えられる。
会話
てOぼ aりtらィ
24
さ.
聞 取
言葉 入力
が今回 2
ーンき
2.
返 言葉
ー
Softbank Robotics Corp. 2017 All rights reserved.
会話をする
“
Spららょれ Rらょん.
”
の設定
会話をする
Spららょれ Rらょん.
の設定
3.
単語
;
単語
というように
半角セミコロンを挟ませると
いくつもの単語を認識できる
(
今回は
2
つ
)
1.Speech Reco
の
パラメーターボタンで設定
2.
聞かせたい言葉を
Wordlist
を設定
今回は
「こんにちは
;
こんばんは」
Softbank Robotics Corp. 2017 All rights reserved.
ー ー 追加
!今回 2
ーン 返答
Softbank Robotics Corp. 2017 All rights reserved.
Softbank Robotics Corp. 2017 All rights reserved.
書 換え
良い ?
イらをtらをょら 各入力 対応
文字列 連結
い
Softbank Robotics Corp. 2017 All rights reserved.
書 換え う!
Softbank Robotics Corp. 2017 All rights reserved.
Softbank Robotics Corp. 2017 All rights reserved.
ー応用問題ー
左記
う 変数 設定
pらppらィ 人 発言 対 対応
返答
プロ
作成せ
イらlり.るらtPaィamらtらィが“れumaをナき.イplろtが“たナき
…変数れumaを 文字列ナ
たい た わ
ナ “たナ
区切
み“
ナぐナい ナぐナ わ
ナめ
ス
生成
lらをが ス き
… ス
長
数字 出力
ン :
りんィ文 ろり文 ィaをるら関数 使い
Softbank Robotics Corp. 2017 All rights reserved.
Softbank Robotics Corp. 2017 All rights reserved.